package com.example.demo.Controller;

import io.swagger.annotations.Api;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

@Controller
public class IndexController {

    @GetMapping(value = "/")
    public String reponseToindexs(){
        return "index";
    }

    @GetMapping(value = "/index.html")
    public String reponseToindex(){
        return "index";
    }

    @GetMapping(value = "/register.html")
    public String reponseToregister(){
        return "register";
    }

    @GetMapping(value = "/update.html")
    public String reponseToupdate(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap){
        String reportthephysician = request.getParameter("reportthephysician");
        String name = request.getParameter("name");
        String phone = request.getParameter("phone");
        String sex = request.getParameter("sex");
        String age = request.getParameter("age");
        String pathologicaltype = request.getParameter("pathologicaltype");
        String conclusion = request.getParameter("conclusion");
        String address = request.getParameter("address");
        String id = request.getParameter("id");
        modelMap.put("reportthephysician" ,reportthephysician);
        modelMap.put("name" ,name);
        modelMap.put("phone" ,phone);
        modelMap.put("sex" ,sex);
        modelMap.put("age" ,age);
        modelMap.put("pathologicaltype" ,pathologicaltype);
        modelMap.put("conclusion" ,conclusion);
        modelMap.put("address" ,address);
        modelMap.put("id" ,id);
        return "update";
    }

    @GetMapping(value = "/insertmedicalrecords.html")
    public String reponseToinsert(){
        return "insertmedicalrecords";
    }

    @GetMapping(value = "/medicalrecords.html")
    public String reponseTomedicalrecords(){
        return "medicalrecords";
    }

}
